package com.xy.mvvmdemo.base

import android.os.Bundle
import android.os.PersistableBundle
import android.util.Log
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.appcompat.app.AppCompatActivity
import com.xy.mvvmdemo.R
import kotlinx.android.synthetic.main.base_activity.*

/**
 * @ClassName BaseActivity
 * @Author xy
 * @Date 2021/7/23 10:48
 * @Description activity基类
 */

abstract class BaseActivity:AppCompatActivity() {
     val TAG = "Activity生命周期"
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        Log.i(TAG, "onCreate: ")
        setContentView(R.layout.base_activity)
        var view = LayoutInflater.from(this).inflate(setLayout(),null)
        var layoutParams = ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.MATCH_PARENT)
        rootView.addView(view,layoutParams)
    }


    //设置布局
    abstract fun setLayout():Int

}